package com.example.ui_mvc

import android.os.Bundle
import android.widget.Button
import android.widget.Spinner
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import java.util.ArrayList;

class MainActivity : AppCompatActivity() {

    val expert = ProgramExpert()
    private var counter = 0

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
         insets
        }
        val button = findViewById<Button>(R.id.button)
        val spinner = findViewById<Spinner>(R.id.spinner)
        val textView = findViewById<TextView>(R.id.textView)
        val button4 = findViewById<Button>(R.id.button4)
        val textView2 = findViewById<TextView>(R.id.textView2)
        button.setOnClickListener{
            val selectedFeature = spinner.selectedItem.toString()
            textView.text = expert.getLanguage(spinner.selectedItem.toString())
        }
        button4.setOnClickListener {
            counter++
            textView2.append("\nThis is a new textview $counter")

        }
    }
}